<?php declare(strict_types=1);
/**
 * This file is part of Swoft.
 *
 * @link     https://swoft.org
 * @document https://swoft.org/docs
 * @contact  group@swoft.org
 * @license  https://github.com/swoft-cloud/swoft/blob/master/LICENSE
 */

namespace App\Rpc\Service;

use App\Rpc\Lib\UserInterface;
use Exception;
use Swoft\Co;
use Swoft\Rpc\Server\Annotation\Mapping\Service;
use Swoft\Bean\Annotation\Mapping\Inject;
use App\Model\Logic\MemberLogic;

/**
 * Class UserService
 *
 * @since 2.0
 *
 * @Service()
 */
class UserService implements UserInterface
{
    /**
     * @Inject()
     *
     * @var MemberLogic
     */
    private $member_logic;

    /**
     * @param int   $id
     * @param mixed $type
     * @param int   $count
     *
     * @return array
     */
    public function getList(int $id, $type, int $count = 10): array
    {
        return ['name' => ['list']];
    }

    /**
     * @param array $param
     * @return int
     */
    public function doLogin(array $param): array
    {
        return $this->member_logic->verifyUser($param);
    }

    /**
     * @param array $param
     * @return int
     */
    public function doRegister(array $param): int
    {
        return $this->member_logic->registerUser($param);
    }

    /**
     * @param int $user_id
     * @return array
     */
    public function getUser(int $user_id): array
    {
        return $this->member_logic->getUser($user_id);
    }

    /**
     * @param string $user_id
     * @return array
     */
    public function getUserDetail(string $user_id): array
    {
        return $this->member_logic->getUserDetail($user_id);
    }
}
